/**
 * 
 */
package com.zhenai.rocyuan.web.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.zhenai.rocyuan.web.common.WebContext;

/**
 * @author Gao Youbo
 * @since 2012-12-5
 * @Description
 * @TODO 将request、response加入到context变量中
 */
public class WebContextInterceptor extends HandlerInterceptorAdapter {
 
	private static final Logger log = Logger.getLogger(WebContextInterceptor.class);
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        
    	log.info("WebContextInterceptor  将 request response 注入 WebContext ");
        WebContext.getInstance().setRequest(request);
        WebContext.getInstance().setResponse(response);
        return super.preHandle(request, response, handler);
    }
}
